<template>
    <div class="introduceMap">
        <div class="left">
            <h3 class="title">【开放公告】</h3>
            <ul class="cellBox" v-for="(con,index) of outInfoArr" :key="index">
                <li class="leftLi">
                    <p class="text"><span class="numStyle">{{index+1}}</span>{{con.introduce}}</p>
                </li>
            </ul>
        </div>
        <div class="right">
             <!-- 天气信息 -->
            <weather :weatherDate="weatherDate" :todayDate="todayDate" :wendu="wendu" :city="city"/>
        </div>
    </div>
</template>

<style scoped>
.introduceMap {
    /* position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0; */
    display: flex;
    justify-content: space-between;
    border-radius: 5px;
}
.left {
    width: 361px;
    /* background-color: #67C23A; */
    /* rgb(52, 58, 113) */
    background-color: #1049a9;
    padding: 3rem;
    color: white;
    overflow: hidden;
    border-radius: 5px;
}
.right {
    flex-grow: 1;
    background-color: rgb(165,165,185);
    position: relative;
    overflow: hidden;
    border-radius: 5px;
}
.leftLi {
    padding: 6px 0 5px;
    line-height: 1.4;
}
.text {
    width:320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 序号 */
.numStyle {
    display: inline-block;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    line-height: 35px;
    background-color: #ccc;
    text-align: center;
}
</style>

<style scoped>
.cellBox {
    border-bottom: 1px solid #b9b9b9;
    font-size: 1rem;
    /* padding: .6rem; */
}
.title {
    text-align: center;
    font-size: 36px;
    margin: 0;
}

</style>
<script>
import weather from "./weather"
export default {
    data(){
         return {
            weatherDate:[
                {
                    date: "26日星期三",
                    high: "高温 19℃",
                    low: "低温 12℃",
                    fengxiang: "无持续风向",
                    type: "多云"
                },
            ],
            todayDate:{
                date: "26日星期三",
                high: "高温 19℃",
                low: "低温 12℃",
                fengxiang: "无持续风向",
                type: "多云"
            },
            wendu:10,
            city:'成都',
            listInfo:3
        }
    },
    components:{
        weather
    },
    props:{
        outInfoArr:{
            type:Array,
            default:()=>[]
        }
    },
    created(){
        
        new Promise((res,rej)=>{
            // 发送请求信息，获取地理位置
            this.$api.axios("https://restapi.amap.com/v3/ip?key=4c75405d2e43b5a46a4ccd6c28dc57c1").then(data=>{
                if(data.data.status){
                    this.city=data.data.city;
                    res()
                }
            })
        }).then(()=>{
            console.log('this.city',this.city)
            this.$api.axios("http://wthrcdn.etouch.cn/weather_mini?city="+this.city).then((date)=>{
                // this.weatherDate=date.data.data;
                this.wendu=date.data.data.wendu;
                this.city=date.data.data.city;
                this.todayDate=date.data.data.forecast.splice(0,1)[0];
                this.weatherDate=date.data.data.forecast;
                console.log('天气数据',this.weatherDate)
            })
        })
        
    }
}
</script>